import request from '@/utils/request'

// 获取sku通过 spuId
export const getkuBySpuIdApi = (spuId) => {
  return request.get(`/admin/product/findBySpuId/${spuId}`)
}

// 添加sku
export const addSkuApi = (data) => {
  console.log(data)
  return request.post(`/admin/product/saveSkuInfo`, data)
}

// 修改sku
export const updateSkuInfoApi = (data) => {
  console.log(data)
  return request.post(`/admin/product/updateSkuInfo`, data)
}
// 获取sku列表
export const getSkuListApi = (page, limit) => {
  return request.get(`/admin/product/list/${page}/${limit}`)
}

// 获取sku信息
export const getSkuInfoApi = (skuId) => {
  return request.get(`/admin/product/getSkuById/${skuId}`)
}

// 商品上架
export const skuOnSaleApi = (skuId) => {
  return request.get(`/admin/product/onSale/${skuId}`)
}

// 商品下架
export const skuCancelSaleApi = (skuId) => {
  return request.get(`/admin/product/cancelSale/${skuId}`)
}
